package com.soap.service;

import com.soap.entities.Student;
import lombok.extern.slf4j.Slf4j;

import javax.jws.WebService;
import javax.xml.ws.BindingType;
import javax.xml.ws.soap.Addressing;
import javax.xml.ws.soap.SOAPBinding;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap;
import java.util.List;

/**
 * @author lzy
 * @version v1.0
 * Create DateTime: 2019/4/16 21:49
 */
@Slf4j
@WebService
@BindingType(value = SOAPBinding.SOAP12HTTP_BINDING)
@Addressing
public class StudentWsImpl implements StudentWs {
    @Override
    public Student getByName(String name) {
        log.info("server getByName() " + name);
        return new Student("test", 23, 10000);
    }

    @Override
    public List<Student> getAll() {
        log.info("server getAll()");
        List<Student> students = new ArrayList<>(Arrays.asList(new Student("test1", 19, 10200), new Student("test2", 18, 12000), new Student()));
        return students;
    }

    @Override
    public HashMap<String, Student> getMapByPrice(double price) {
        log.info("server getMapPrice");
        HashMap<String, Student> map = new HashMap<>(16);
        map.put("test1", new Student("test1", 23, 10100));
        map.put("test2", new Student("test2", 17, 10500));
        map.put("test3", new Student("test3", 21, 13100));
        return map;
    }
}
